package com.monolithiot.sso.interceptor.conf;

import com.monolithiot.sso.interceptor.FrontAccessInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 2018/12/15 Create by 郭文梁
 * InterceptorConfigure
 * 拦截器自动配置组件
 *
 * @author 郭文梁
 * @date 2018/12/15
 */
@Component
@Configuration
public class InterceptorConfigure implements WebMvcConfigurer {
    private final FrontAccessInterceptor frontAccessInterceptor;

    @Autowired
    public InterceptorConfigure(FrontAccessInterceptor frontAccessInterceptor) {
        this.frontAccessInterceptor = frontAccessInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(frontAccessInterceptor);
    }
}
